package com.itboye.jigongbao.retrofit.api;


import com.itboye.jigongbao.bean.ConfigInfo;
import com.itboye.jigongbao.bean.FinanceBillBean;
import com.itboye.jigongbao.bean.JiYiBiBean;
import com.itboye.jigongbao.bean.LoginInfo;
import com.itboye.jigongbao.bean.MonthAccountBean;
import com.itboye.jigongbao.bean.NotifyMessageBean;
import com.itboye.jigongbao.bean.UpdateImageBean;
import com.itboye.jigongbao.bean.WorkerBean;
import com.itboye.jigongbao.retrofit.base.BaseResponse;
import com.itboye.jigongbao.retrofit.util.Cache;

import java.util.ArrayList;

import okhttp3.MultipartBody;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Query;
import rx.Observable;

/**
 * 定义Retrofit请求的api接口
 *
 * @Cache(isCache = false)  false:不需要缓存   true 或者不写该注解：需要缓存    默认为需要
 * 示例：By_Config_app 定义接口名称需和api接口上的type字段相同，以便于反射或去该方法上的注解
 */
public interface RetrofitApi {


    //alg=md5_v2&client_id=by565fa4facdb191&app_version=101&from=android&time=121545664&notify_id=135451534
    @Cache(isCache = true)
    @POST("api.php")
    Observable<BaseResponse<ConfigInfo>> By_Config_app(@Query("itboye") String itboye);

    @Cache(isCache = false)
    @POST("api.php")
    Observable<BaseResponse<String>> By_SecurityCode_send(@Query("itboye") String itboye);

    @Cache(isCache = false)
    @POST("api.php")
    Observable<BaseResponse<LoginInfo>> By_UserAccount_loginByMobile(@Query("itboye") String itboyeData);

    @Cache(isCache = false)
    @POST("api.php")
    Observable<BaseResponse<LoginInfo>> By_UserProfile_update(@Query("itboye") String itboyeData);

    @Multipart
    @POST("picture/curl_upload.html?client_id=byTest123456")
    Observable<UpdateImageBean> avatar(@Query("type") String type, @Query("uid") String uid, @Query("md5") String md5, @Query("sha1") String sha1, @Query("ori_name") String ori_name, @Part MultipartBody.Part file);

    /**
     * 记工
     *
     * @param itboyeData
     * @return
     */
    @Cache(isCache = false)
    @POST("api.php")
    Observable<BaseResponse<String>> By_JgbRecord_add(@Query("itboye") String itboyeData);

    /***
     * 工人修改记一笔
     * @param itboyeData
     * @return
     */
    @Cache(isCache = false)
    @POST("api.php")
    Observable<BaseResponse<String>> By_JgbRecord_update(@Query("itboye") String itboyeData);

    /***
     * 工人首页月账本数据
     * @param itboyeData
     * @return
     */
    @Cache(isCache = true)
    @POST("api.php")
    Observable<BaseResponse<ArrayList<MonthAccountBean>>> By_JgbRecord_workerIndex(@Query("itboye") String itboyeData);

    /***
     * 工头首页月账本数据
     * @param itboyeData
     * @return
     */
    @Cache(isCache = true)
    @POST("api.php")
    Observable<BaseResponse<ArrayList<MonthAccountBean>>> By_JgbRecord_overseerIndex(@Query("itboye") String itboyeData);

    /***
     * 工人记一笔列表
     * @param itboyeData
     * @return
     */
    @Cache(isCache = true)
    @POST("api.php")
    Observable<BaseResponse<JiYiBiBean>> By_JgbRecord_queryWorker(@Query("itboye") String itboyeData);


    /***
     * 工头记一笔列表
     * @param itboyeData
     * @return
     */
    @Cache(isCache = true)
    @POST("api.php")
    Observable<BaseResponse<JiYiBiBean>> By_JgbRecord_queryOverseer(@Query("itboye") String itboyeData);


    /***
     * 工头审核记录查询接口
     * @param itboyeData
     * @return
     */
    @Cache(isCache = true)
    @POST("api.php")
    Observable<BaseResponse<JiYiBiBean>> By_JgbRecord_queryAuditRecordForOverseer(@Query("itboye") String itboyeData);

    /***
     * 工人审核记录查询接口
     * @param itboyeData
     * @return
     */
    @Cache(isCache = true, isPaging = true)
    @POST("api.php")
    Observable<BaseResponse<JiYiBiBean>> By_JgbRecord_queryAuditRecordForWorker(@Query("itboye") String itboyeData);

    /***
     * 审核
     * @param itboyeData
     * @return
     */
    @Cache(isCache = false)
    @POST("api.php")
    Observable<BaseResponse<String>> By_JgbRecord_audit(@Query("itboye") String itboyeData);

    /***
     * 工人财务统计查询
     * @param itboyeData
     * @return
     */
    @Cache(isCache = true)
    @POST("api.php")
    Observable<BaseResponse<FinanceBillBean>> By_JgbFinanceBill_worker(@Query("itboye") String itboyeData);

    /***
     * 工头财务统计查询
     * @param itboyeData
     * @return
     */
    @Cache(isCache = true)
    @POST("api.php")
    Observable<BaseResponse<FinanceBillBean>> By_JgbFinanceBill_overseer(@Query("itboye") String itboyeData);

    /***
     * 消息查询
     * @param itboyeData
     * @return
     */
    @Cache(isCache = true)
    @POST("api.php")
    Observable<BaseResponse<ArrayList<NotifyMessageBean>>> By_Message_query(@Query("itboye") String itboyeData);

    /***
     * 查询记录下所有工头名字
     * @param itboyeData
     * @return
     */
    @Cache(isCache = true)
    @POST("api.php")
    Observable<BaseResponse<ArrayList<WorkerBean>>> By_JgbRecord_queryAllWorkerName(@Query("itboye") String itboyeData);


    /***
     * 消息详情查询
     * @param itboyeData
     * @return
     */
    @Cache(isCache = true)
    @POST("api.php")
    Observable<BaseResponse<NotifyMessageBean>> By_Message_info(@Query("itboye") String itboyeData);


    /***
     * 记录详情查询
     * @param itboyeData
     * @return
     */
    @Cache(isCache = true)
    @POST("api.php")
    Observable<BaseResponse<JiYiBiBean.JiYiBiEntity>> By_JgbRecord_info(@Query("itboye") String itboyeData);

    /***
     * 未读消息查询
     * @param itboyeData
     * @return
     */
    @Cache(isCache = true)
    @POST("api.php")
    Observable<BaseResponse<Integer>> By_Message_unreadCount(@Query("itboye") String itboyeData);

    /**
     * 删除消息
     * @param itboyeData
     * @return
     */
    @Cache(isCache = false)
    @POST("api.php")
    Observable<BaseResponse<String>> By_Message_del(@Query("itboye") String itboyeData);

    /**
     * 意见反馈
     * @param itboyeData
     * @return
     */
    @Cache(isCache = false)
    @POST("api.php")
    Observable<BaseResponse<String>> By_Suggest_add(@Query("itboye") String itboyeData);
}